import * as  THREE from 'three';
import { Proton } from "../core/Proton.js";
import { BaseRender } from './BaseRender.js';

export    class PointsRender  extends BaseRender{
    constructor(ps) {
        super();
        this.points = ps;
        this.name = "PointsRender";
    }
    onProtonUpdate() {
    }
    onParticleCreated(particle) {
        if (!particle.target) {
            particle.target = new THREE.Vector3();
        }

        particle.target.copy(particle.p);
        this.points.geometry.vertices.push(particle.target);
    }
    onParticleUpdate(particle) {
        if (particle.target) {
            particle.target.copy(particle.p);
        }
    }
    onParticleDead(particle) {
        if (particle.target) {
            var index = this.points.geometry.vertices.indexOf(particle.target);
            if (index > -1)
                this.points.geometry.vertices.splice(index, 1);

            particle.target = null;
        }
    }
}





;
